//路由器对象模块
import Vue from 'vue'
import VueRouter from 'vue-router'


//import Msite from '../pages/Msite/Msite.vue'
//import Order from '../pages/Order/Order.vue'
//import Profile from '../pages/Profile/Profile.vue'
//import Search from '../pages/Search/Search.vue'

const Msite = () => import('../pages/Msite/Msite.vue')
const Order = () => import('../pages/Order/Order.vue')
const Profile = () => import('../pages/Profile/Profile.vue')
const Search = () => import('../pages/Search/Search.vue')

import Login from '../pages/Login/Login.vue'
import Shop from '../pages/Shop/Shop.vue'
import ShopGoods from '../pages/Shop/ShopGoods/ShopGoods.vue'
import ShopRatings from '../pages/Shop/ShopRatings/ShopRatings.vue'
import ShopInfo from '../pages/Shop/ShopInfo/ShopInfo.vue'

//声明使用插件
Vue.use(VueRouter)

export default new VueRouter({
  //所有路由
  routes: [
    {
      path: '/Msite',
      component: Msite,//返回路由组件的函数，只有执行此函数才会加载路由组件，这个函数在请求对应路径时才会执行
      /*显示底部组件*/
      meta: {
        showFooter: true
      }
    },
    {
      path: '/Order',
      component: Order,
      meta: {
        showFooter: true
      }
    },
    {
      path: '/Profile',
      component: Profile,
      meta: {
        showFooter: true
      }
    },
    {
      path: '/Search',
      component: Search,
      meta: {
        showFooter: true
      }
    },
    {
      path: '/Login',
      component: Login
    },
    {//默认
      path: '/',
      redirect: '/Msite'
    },
    {
      path: '/Shop',
      component: Shop,
      children: [
        {
          path: '/shop/goods',
          component: ShopGoods
        },
        {
          path: '/shop/ratings',
          component: ShopRatings
        },
        {
          path: '/shop/info',
          component: ShopInfo
        },
        {
          path: '/',
          redirect: '/shop/goods'
        },
      ]
    }
  ]
})
